package com.example.a2209_shop

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import com.alibaba.android.arouter.launcher.ARouter
import com.example.a2209_shop.databinding.ActivityWelBinding
import com.example.base.mvvm.BaseViewActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

/**
 * 闪屏页  --欢迎页  --广告页
 */
class WelActivity : BaseViewActivity<ActivityWelBinding>() {
    override fun initData() {
    }

    override fun initView() {
        //协程方式实现倒计时
        lifecycleScope.launch {
            for (i in 3 downTo 1){
                delay(1000)
                binding.djs.text = "$i"
                if(i==1){
                    ARouter.getInstance().build("/app/MainActivity").navigation()
                }
            }
        }
    }

    override fun getLayout(): Int = R.layout.activity_wel

}